/*
 * JUnit Test Driver for the class Task
 * 
 */
// @author A0105514U
/** @author A0105514U */

package global;

import org.junit.Test;
import static org.junit.Assert.*;
import global.Time;

public class TaskTestDriver {
	
	// Testing regular task constructor with all attributes given
	@Test
	public void testTaskt1(){
		String taskType = "time";
		String taskName = "MA3269 Test";
		String taskLocation = "Lecture Theather 15";

		Time sDate = new Time(2013,2,29,16,8);
		Time eDate2 = new Time(2013,3,21,12,00);
		
		Task task = new Task(taskType,taskName,taskLocation,sDate,eDate2);
		
		String taskContent = "time#MA3269 Test#Lecture Theather 15#201303011608#201303211200";
		assertTrue(task.toString().equalsIgnoreCase(taskContent));
	}
	
	// Testing time task string constructor
	@Test
	public void testTaskt2(){
		Task task = new Task("time#MA3269 Test#Lecture Theather 15#201302281608#201303311200");
		String taskString = "time#MA3269 Test#Lecture Theather 15#201302281608#201303311200";
		assertEquals(task.toString(),taskString);
	}
	
	// Testing float task constructor
	@Test
	public void testTask3(){
		Task task = new Task("float","read books");
		String taskString = "float#read books##null#null";
		assertEquals(task.toString(),taskString);
	}
	
	// Testing float task string constructor
	@Test
	public void testTask4(){
		Task task = new Task("float#read books##null#null");
		String taskString = "float#read books##null#null";
		assertEquals(task.toString(),taskString);
	}
	
	// Testing Task setSync()
	@Test
	public void testTask5(){
		Task task = new Task("float#read books##null#null");
		assertEquals(task.getSyncStatus(),false);
		task.setSync();
		assertEquals(task.getSyncStatus(),true);
	}
	
	// Testing Task markDone()
	@Test
	public void testTask6(){
		Task task = new Task("float#read books##null#null");
		assertEquals(task.getTaskStatus(),false);
		task.markDone();
		assertEquals(task.getTaskStatus(),true);
	}
	
	// Testing getFormattedTaskString()
	@Test
	public void testTask7(){
		Task task = new Task("time#MA3269 Test#Lecture Theather 15#201302281608#201303311200");
		String formattedTaskString = "MA3269 Test at Lecture Theather 15 from 2013/02/28/16/08 to 2013/03/31/12/00";
		assertEquals(task.getFormattedTaskString(),formattedTaskString);
	}
	
	@Test
	public void testTask8(){
		Task task = new Task("time#MA3269 Test#Lecture Theather 15#201302281608#201303311200");
		String formattedTaskStringNew = "time multiDayEvent 28/02/2013 (Thur) 4:08PM 31/03/2013 (Sun) 12:00PM  MA3269 Test at Lecture Theather 15";
		assertEquals(task.getFormattedTaskStringNew(),formattedTaskStringNew);
	}
}